﻿dynamic class com.c3d.mediaRotator.ui.TabbedOverlayTab extends MovieClip
{
    static var _EMBEDDED_FONT: String = "Verdana";
    var _tabLabel: String = "";
    var _tabLabelDimAlpha: Number = 50;
    var _tabLabelSize: Number = 10;
    var _tabLabelColor: Number = 16763904;
    var _tabColor: Number = 16763904;
    var _tabDimColor: Number = 16711680;
    var _tabDimLinerColor: Number = 3355443;
    var _tabDimAlpha: Number = 0.5;
    var _tabHeight: Number = 20;
    var _tabWidth: Number = 100;
    var _tabPanelController = null;
    var _tabSelected: Boolean = false;
    var _isReady: Boolean = false;
    var _height;
    var _highlightState;
    var _tabCornerRadius;
    var _tabFill;
    var _tabLabelTextField;
    var _tabLabelTextFormat;
    var _tabShape;
    var _tabShapeMask;
    var _width;
    var _xscale;
    var _xscaleTween;
    var _y;
    var _yscale;
    var _yscaleTween;
    var createEmptyMovieClip;
    var createTextField;
    var filters;
    var getNextHighestDepth;
    var onPress;
    var onRelease;
    var onRollOut;
    var onRollOver;
    var useHandCursor;

    function TabbedOverlayTab()
    {
        super();
        this._isReady = true;
    }

    function initialize($tabData, $tabNum)
    {
        this._tabPanelController = $tabData.controller;
        for (var __reg3 in $tabData) 
        {
        };
        this._tabLabel = $tabData.label;
        this.drawTabShape();
        this._highlightState = this.drawTabHighlightSprite();
        this.drawTabLabel();
        this.drawTabMask();
        this.drawTabGlow(0);
        this.attachEventListeners();
        if ($tabNum == 0) 
        {
        };
		
    }

    function drawTabShape()
    {
        var __reg2 = this.createEmptyMovieClip("tabBackground", this.getNextHighestDepth());
        __reg2.beginFill(this._tabDimColor, 100);
        __reg2.moveTo(0, 0);
        __reg2.lineTo(this._tabWidth, 0);
        __reg2.lineTo(this._tabWidth, this._tabHeight);
        __reg2.lineTo(0, this._tabHeight);
        __reg2.lineTo(0, 0);
        __reg2.endFill();
        this._tabFill = __reg2;
    }

    function drawTabHighlightSprite()
    {
        var __reg2 = this._tabFill.createEmptyMovieClip("highlightState", this._tabFill.getNextHighestDepth());
        __reg2.beginFill(this._tabColor, 100);
        __reg2.moveTo(0, 0);
        __reg2.lineTo(this._tabWidth, 0);
        __reg2.lineTo(this._tabWidth, this._tabHeight);
        __reg2.lineTo(0, this._tabHeight);
        __reg2.lineTo(0, 0);
        __reg2.endFill();
        __reg2._alpha = 0;
        return __reg2;
    }

    function drawTabLabel()
    {
        this._tabLabelTextField = this.createTextField("tabLabelTextField", this.getNextHighestDepth(), 0, 0, 0, 0);
        //this._tabLabelTextField.embedFonts = true;
        this._tabLabelTextField.autoSize = "center";
        this._tabLabelTextField._height = this._tabHeight;
        this._tabLabelTextField._width = this._tabWidth;
        this._tabLabelTextField._alpha = this._tabLabelDimAlpha * 100;
        this._tabLabelTextFormat = new TextFormat();
        this._tabLabelTextFormat.bold = true;
        this._tabLabelTextFormat.size = this._tabLabelSize;
        this._tabLabelTextFormat.color = this._tabLabelColor;
        this._tabLabelTextFormat.font = com.c3d.mediaRotator.ui.TabbedOverlayTab._EMBEDDED_FONT;
		trace("Labrl222="+this._tabLabel);
        this._tabLabelTextField.text = this._tabLabel;
        this._tabLabelTextField.setTextFormat(this._tabLabelTextFormat);
        this._tabLabelTextField._height = this._tabLabelTextField.textHeight + 5;
        this._tabLabelTextField._width = this._tabLabelTextField.textWidth + 5;
        this._tabLabelTextField._y = this._tabLabelTextField._height / 2;
    }

    function drawTabMask()
    {
        var __reg2 = this._tabCornerRadius[0];
        this._tabShapeMask = this.createEmptyMovieClip("tabShapeMask", this.getNextHighestDepth());
        this._tabShapeMask.beginFill(0, 50);
        this._tabShapeMask.moveTo(this._tabCornerRadius[0], 0);
        this._tabShapeMask.lineTo(this._width - this._tabCornerRadius[1], 0);
        this._tabShapeMask.curveTo(this._width, 0, this._width, this._tabCornerRadius[1]);
        this._tabShapeMask.lineTo(this._width, this._height);
        this._tabShapeMask.lineTo(0, this._height);
        this._tabShapeMask.lineTo(0, this._tabCornerRadius[0]);
        this._tabShapeMask.curveTo(0, 0, this._tabCornerRadius[0], 0);
        this._tabShapeMask.endFill();
        this._tabFill.setMask(this._tabShapeMask);
    }

    function set props($pObj)
    {
		 //$pObj.label="JHOOOO";
		trace("LLABEL4444="+$pObj.label);
        if ($pObj.label) 
        {
            this._tabLabel = $pObj.label;
        }
        if ($pObj.labelcolor) 
        {
            this._tabLabelColor = $pObj.labelcolor;
        }
        if ($pObj.labelsize) 
        {
            this._tabLabelSize = $pObj.labelsize;
        }
        if ($pObj.labeldimalpha) 
        {
            this._tabLabelDimAlpha = $pObj.labeldimalpha;
        }
        if ($pObj.shape) 
        {
            this._tabShape = $pObj.shape;
        }
        if ($pObj.color) 
        {
            this._tabColor = $pObj.color;
        }
        if ($pObj.height) 
        {
            this._tabHeight = $pObj.height;
        }
        if ($pObj.width) 
        {
            this._tabWidth = $pObj.width;
        }
        if ($pObj.cornerradius) 
        {
            this._tabCornerRadius = $pObj.cornerradius;
        }
        if ($pObj.dimcolor) 
        {
            this._tabDimColor = $pObj.dimcolor;
        }
        if ($pObj.dimalpha) 
        {
            this._tabDimAlpha = $pObj.dimalpha;
        }
    }

    function get isReady()
    {
        return this._isReady;
    }

    function attachEventListeners()
    {
        this.onPress = mx.utils.Delegate.create(this, this.onTabPress);
        this.onRelease = mx.utils.Delegate.create(this, this.onTabRelease);
        this.onRollOver = mx.utils.Delegate.create(this, this.onTabRollover);
        this.onRollOut = mx.utils.Delegate.create(this, this.onTabRollout);
    }

    function requestShowHighlight()
    {
        if (this._highlightState._alpha == 0 && this._tabSelected == false) 
        {
            var __reg3 = new mx.transitions.Tween(this._highlightState, "_alpha", mx.transitions.easing.Strong.easeOut, this._highlightState._alpha, 100, 2, true);
            this._yscaleTween = new mx.transitions.Tween(this, "_y", mx.transitions.easing.Strong.easeOut, this._y, -10, 0.5, true);
            var __reg2 = new mx.transitions.Tween(this._tabLabelTextField, "_alpha", mx.transitions.easing.Strong.easeOut, this._tabLabelTextField._alpha, 100, 0.5, true);
            this._tabSelected = true;
            this.useHandCursor = false;
            return;
        }
    }

    function requestHideHighlight()
    {
        var __reg3 = new mx.transitions.Tween(this._highlightState, "_alpha", mx.transitions.easing.Strong.easeOut, this._highlightState._alpha, 0, 1, true);
        this._yscaleTween = new mx.transitions.Tween(this, "_y", mx.transitions.easing.Strong.easeOut, this._y, 0, 0.5, true);
        var __reg2 = new mx.transitions.Tween(this._tabLabelTextField, "_alpha", mx.transitions.easing.Strong.easeOut, this._tabLabelTextField._alpha, this._tabLabelDimAlpha * 100, 0.5, true);
        this._tabSelected = false;
        this.useHandCursor = true;
    }

    function growTab()
    {
        this._xscaleTween = new mx.transitions.Tween(this, "_xscale", mx.transitions.easing.Strong.easeOut, this._xscale, 100, 0.5, true);
        this._yscaleTween = new mx.transitions.Tween(this, "_yscale", mx.transitions.easing.Strong.easeOut, this._yscale, 100, 0.5, true);
    }

    function shrinkTab()
    {
        this._xscaleTween = new mx.transitions.Tween(this, "_xscale", mx.transitions.easing.Strong.easeOut, this._xscale, 80, 0.5, true);
        this._yscaleTween = new mx.transitions.Tween(this, "_yscale", mx.transitions.easing.Strong.easeOut, this._yscale, 80, 0.5, true);
    }

    function drawTabGlow($color)
    {
        var __reg2 = this.filters;
        var __reg3 = new flash.filters.GlowFilter($color, 0.5, 10, 10);
        __reg2.push(__reg3);
        this.filters = __reg2;
    }

    function removeTabGlow()
    {
        var __reg2 = new Array();
        this.filters = __reg2;
    }

    function onTabPress()
    {
        com.c3d.common.events.CentralDispatch.dispatchEvent({type: "uiTabPress", target: null, controller: this._tabPanelController});
    }

    function onTabRelease()
    {
    }

    function onTabRollover()
    {
        if (this._tabSelected) 
        {
            return;
        }
		//this._tabLabelTextField.text="ddddddddd";
        var __reg2 = new mx.transitions.Tween(this._tabLabelTextField, "_alpha", mx.transitions.easing.Strong.easeOut, this._tabLabelTextField._alpha, 100, 0.5, true);
        this._yscaleTween = new mx.transitions.Tween(this, "_y", mx.transitions.easing.Strong.easeOut, this._y, -20, 0.5, true);
    }

    function onTabRollout()
    {
        if (this._tabSelected) 
        {
            return;
        }
        var __reg2 = new mx.transitions.Tween(this._tabLabelTextField, "_alpha", mx.transitions.easing.Strong.easeOut, this._tabLabelTextField._alpha, this._tabLabelDimAlpha * 100, 0.5, true);
        this._yscaleTween = new mx.transitions.Tween(this, "_y", mx.transitions.easing.Strong.easeOut, this._y, 0, 0.5, true);
    }

}
